﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TransactionModule.cs" company="Concept Architecture">
//   (c) 2010 Muhammad Umer Farooq
// </copyright>
// <summary>
//   Defines the <seealso cref="TransactionModule" /> type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Hisaab.Client.Modules.Core.Transaction
{
    using Hisaab.Client.Common;
    using Hisaab.Client.Modules.Core.Transaction.View;

    using Microsoft.Practices.Prism.Modularity;
    using Microsoft.Practices.Prism.Regions;
    using Microsoft.Practices.ServiceLocation;
    using Microsoft.Practices.Unity;

    /// <summary>
    /// Defines the <seealso cref="TransactionModule"/> type.
    /// </summary>
    public class TransactionModule : IModule
    {
        /// <summary>D:\Projects\Hisaab\Client\Modules\Core\Transaction\View\
        /// Member variable TransactionEditor
        /// </summary>
        public const string TransactionEditor = "TransactionEditor";

        /// <summary>
        /// Member variable TransactionsName
        /// </summary>
        public const string TransactionsName = "Transactions";

        /// <summary>
        /// Member variable ModuleName
        /// </summary>
        public const string ModuleName = "TransactionModule";

        /// <summary>
        /// Member variable TransactionsTab
        /// </summary>
        public const string TransactionsTab = "TransactionsTab";

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public void Initialize()
        {
            var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>();
            regionManager.RegisterViewWithRegion(Regions.HomeAddGroup, typeof(TransactionAddButton));
            regionManager.RegisterViewWithRegion(Regions.HomeListGroup, typeof(TransactionViewButton));
            regionManager.RegisterViewWithRegion(Regions.RibbonRegion, typeof(TransactionsTab));

            var container = ServiceLocator.Current.GetInstance<IUnityContainer>();

            container.RegisterType<object, TransactionsTab>(TransactionsTab);
            container.RegisterType<object, TransactionEditor>(TransactionEditor);
            container.RegisterType<object, Transactions>(TransactionsName);
        }

        /// <summary>
        ///  Defines the <seealso cref="NavigationParameters"/> type.
        /// </summary>
        public static class NavigationParameters
        {
            /// <summary>
            /// Id navigation parameter
            /// </summary>
            public const string Id = "ID";

            /// <summary>
            /// Tag Id navigation parameter
            /// </summary>
            public const string TagId = "TagId";
        }
    }
}